<!DOCTYPE html>
<html lang="en">
<head>
    <title>{:config('site_title')}</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="">
    {include file="common:common_css" /}
</head>
<body ontouchstart>
    <div class="weui-tab">
        <div class="weui-tab__bd">
            <div class="page-group">
                <header class="bar bar-nav">
                    <a class="button button-link button-nav pull-left" onclick="goBack('{:url('Message/index')}');"><span class="icon fa fa-angle-left"></span>返回</a>
                    <h1 class="title">消息 - 详情</h1>
                    <button id="btnDel" class="button button-link button-nav pull-right" data-href="{:url('del')}" data-id="{$model.encrypt_id}"><span class="icon fa fa-trash-o"></span></button>
                </header>
                <div class="content weui-cells weui-cells_form letu-cells_not_top_line">
                    <div class="weui-cell">
                        <div class="weui-cell__bd">
                            <p class="sell_money">{$model.msg_title}</p>
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd"><label class="weui-label">消息类型：</label></div>
                        <div class="weui-cell__bd">
                            <p>{:config('app.msg_type.'.$model['msg_type'])}</p>
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd"><label class="weui-label">消息时间：</label></div>
                        <div class="weui-cell__bd">
                            <p>{$model.msg_time|date='Y-m-d H:i:s'}</p>
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__bd">
                            <div class="letu-box">
                                <div class="letu-box-title">消息内容：</div>
                                <div class="letu-box-body">
                                    <p>{$model.msg_content}</p>
                                </div>
                            </div>
                        </div>
                    </div>
            </div>
        </div>
        </div>
    </div>
{include file="common:common_js" /}
<script type="text/javascript">
    $(document).ready(function(){
        $(document).on("click", "#btnDel", function() {
            var $element = $(this);
            var data = {};
            data.id = $element.attr('data-id');

            $.confirm("您确定要删除消息？", "确认删除?", function() {
                $.ajax({
                    type:'post',
                    url:$element.attr("data-href"),
                    data:data,
                    dataType:'json',
                    success:function(response){
                        if(response.success){
                            if(response.url != ""){
                                setTimeout(function(){
                                    window.location.href = response.url;
                                },2000);
                            }
                            $.toptip(response.msg, 'success');
                        }else{
                            $.toptip(response.msg, 'error');
                        }
                    },
                    error:function(XMLHttpRequest, textStatus, errorThrown){
                    }
                });
            }, function() {
                //取消操作
            });

            return false;
        });

        //发起阅读更新
        var params_json = {};
        params_json.id = "{$model.encrypt_id}";
        params_json.is_read = "{$model.is_read}";
        $.ajax({
            type:'post',
            url:"{:url('do_read')}",
            data:params_json,
            dataType:'json',
            success:function(response){
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
            }
        });
    });
</script>
</body>
</html>